﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/ViMap.Master" Inherits="System.Web.Mvc.ViewPage<List<BusinessLogic.BizPlace>>" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        window.location.hash = '<%= ViewData["currCity"].ToString() %>';
    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        $(window).load(function () {
            mCustomScrollbars_1();
        });
    </script>    

    <div style="width:336px;z-index:1; position:absolute; top:100px; visibility:hidden" id="draggable">
	    <b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>
        <div style="border: 3px solid rgba(0, 0, 0, 0.75); border-top: none; border-bottom: none ">
            <a onclick="closeSearchBox()"><div id="closeBtn"></div></a>
            <div class="mbox_caption1">&nbsp;<span id="count"></span></div>
        </div>
        <div class="mbox_add1"><img src="../../images/start_point.png" align="left" style="margin-left:5px" />&nbsp;<b>Các địa điểm <span id="sumResult"></span></b></div>
	    <div id="mcs1_container">
	    <div class="customScrollBox" >
		    <div class="container" >
    		    <div class="content" id="search_list">
                            <ul id="list">
                                <script type="text/javascript">
                                    $("document").ready(function () {
                                        var address = '<%= ViewData["address"].ToString() %>';
                                        $("#txtAddress").val(address);
                                        var isEmpty = true;
                                        $.getJSON("place/getPlacebyAddress/" + removeSpecialChars(address) + "/" + '<%= ViewData["currCity"].ToString() %>', function (data) {
                                            $.each(data, function (index, item) {
                                                if (data) {
                                                    isEmpty = false;
                                                }
                                                else
                                                    return;
                                                var line = '<li>'
                                                       + '<a onclick="moveToPlace(' + item.id + ')">' + item.title + '</a><br />'
                                                       + '<span>' + item.address + '</span>'
                                                       + '<br/><span id="action"><a onclick="updateStartPoint(' + item.id + ',' + "'" + item.title + "'" + ',0)">Đi từ điểm này</a></span> | <span id="action"><a onclick="updateEndPoint(' + item.id + ',' + "'" + item.title + "'" + ',0)">Đến điểm này</a></span>'
                                                       + '</li>';
                                                $('#list').append(line);
                                            });

                                            if (isEmpty == false) { //if search result is not empty
                                                showSearchBox();
                                                moveToPlace(data[0].id);
                                                $("#sumResult").html("(" + data.length + ")");
                                            }
                                            else { //if search result is empty then search on google
                                                gplaceSearch(address, '<%= ViewData["currCity"].ToString() %>', '0');
                                            }
                                        });

                                    })
                                </script>
                            </ul>
				    </div>
			    </div>
			    <div class="dragger_container">
    			    <div class="dragger"></div>
			    </div>
		    </div>
	    </div>
        <div class="mbox_add1" style="height:2px"></div>
	    <b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b>
    </div>
    <a href="#" onclick="openSearchBox()"><div id="restoreTab" class="restore_tab" style="visibility:hidden"></div></a>
</asp:Content>
